const API = require('../../pages/api/index')
const { typeJson } = require('../../utils/typejson')
let prolist = wx.getStorageSync('prolist')==''?wx.getStorageSync('prolist'):JSON.parse(wx.getStorageSync('prolist'))


Page({

  /**
   * 页面的初始数据
   */
  data: {
    pulldown:"",
    pullup:2,
    addButton:false,
    prolist:wx.getStorageSync('prolist')==''?wx.getStorageSync('prolist'):JSON.parse(wx.getStorageSync('prolist')),
    listConfig: [
      {
        prop: "riskLevelName",
        label: "风险等级",
       
    },
    {
      prop: "identificationType",
      jsonType:typeJson.identificationType,
      label: "辨识类型",
    },
      ],
      slide: {
        slideButton: {
          type:"warn",
          text: '评估',
          extClass: 'test',
            src: '/page/weui/cell/icon_star.svg', // icon的路径
        },
        formConfig: [
          {
            label: 'L（事故可能性）',
            prop: 'possibility',
            jsonType:typeJson.possibility,
            type: 'dropDown',
          },
          {
            label: 'E(暴露于危险环境频率)',
            prop: 'frequency',
            jsonType:typeJson.frequency,
            type: 'dropDown',
          },
          {
            label: 'C（事故后果）',
            prop: 'severity',
            jsonType:typeJson.severity,
            type: 'dropDown',
          },

        ]
      },
    
      formConfig: [
         {
          prop: "identificationType",
          label: "辨识类型",
         type: 'dropDown',
         jsonType:typeJson.identificationType,
         hidden:"edit"
      },
        {
        label: '评估单元',
        prop: 'riskUnitName',
        hidden:"edit"
      },
      {
        label: '危险有害因素',
        prop: 'riskFactors',
        hidden:"edit"
    },
      {
        label: 'L（事故可能性）',
        prop: 'possibility',
        jsonType:typeJson.possibility,
        type: 'dropDown',
      },
      {
        label: 'E(暴露于危险环境频率)',
        prop: 'frequency',
        jsonType:typeJson.frequency,
        type: 'dropDown',
      },
      {
        label: 'C（事故后果）',
        prop: 'severity',
        jsonType:typeJson.severity,
        type: 'dropDown',
      },
      {
        label:'D＝LEC',
        prop: 'results',
        hidden:"edit"
      },
    
      {
        label: '风险等级',
        prop: 'riskLevelName',
        hidden:"edit"
      },

        ],
    
        
        net: {
       
            select: {
              url: `/app/riskIdentification/getList`,
              method: 'post',
              data: {
                mineId: true,
                
              }
            },
            delete: {
              url: '/app/fourColorImage/delete',
              method: 'post',
              data: {
                
              }
            },
            insert: {
              url: '/app/riskAssessment/edit',
              method: 'post',
              data: {
                mineId:prolist.mineId,
              
               
              }
            },
            update: {
              url: '/app/riskAssessment/edit',
              method: 'post',
              data: {
                mineId:prolist.mineId,
              }
            }
  
          
        },
        showCom:true
      },

     
  

  /**
   * 生命周期函数--监听页面加载
   */


  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },
  
  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    console.log('5555');
    this.setData({
      showCom: false
    });
    this.setData({
      showCom: true
    });
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

 /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
    wx.stopPullDownRefresh()
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
    console.log('777');
    this.setData({
      pullup: this.data.pullup + 1
    })
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})